cmake_minimum_required (VERSION 2.6.3)
project (benchmarks)

include_directories ("../../include/cpp0x")
if (NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release)
endif (NOT CMAKE_BUILD_TYPE)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

file (GLOB benchmark_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
foreach (benchmark_source ${benchmark_sources})
   if(${benchmark_source} STREQUAL "VectorAddTbb.cpp")
      message("Excluding VectorAddTbb.cpp")
   else(${benchmark_source} STREQUAL "VectorAddTbb.cpp")
      message("Adding ${benchmark_source}")
      string (REPLACE ".cpp" "" benchmark_prefix ${benchmark_source})
      add_executable (${benchmark_prefix} ${benchmark_source})
   endif(${benchmark_source} STREQUAL "VectorAddTbb.cpp")
endforeach (benchmark_source)

find_package(TBB)
if(TBB_FOUND)
   message("Adding VectorAddTbb.cpp")
   include_directories (${TBB_INCLUDE_DIRS})
   add_executable (VectorAddTbb VectorAddTbb.cpp)
   target_link_libraries(VectorAddTbb ${TBB_LIBRARIES})
endif(TBB_FOUND)
